home *** CD-ROM | disk | FTP | other *** search
Modula Implementation | 1988-08-16 | 1.9 KB | 71 lines |
- IMPLEMENTATION MODULE KermDir;
- (************************************************************************)
- (* Display directory information *)
- (* written: 11.12.85 Matthias Aebi *)
- (* last modification: 26.02.85 Matthias Aebi *)
- (************************************************************************)
-
- FROM NameSearch IMPORT FindNames, NextName;
- FROM Terminal IMPORT WriteString, WriteLn;
- FROM OutTerminal IMPORT WriteC;
- FROM TextScreen IMPORT GetPos, SetPos;
- FROM M2Kermit IMPORT Param1;
-
- CONST
- UpLowEqual = TRUE;
-
- (************************************************************************)
- PROCEDURE Dir;
- (************************************************************************)
- VAR
- fileName : ARRAY[0..31] OF CHAR;
- foundOne : BOOLEAN;
- fileNo : CARDINAL;
- versionNo : CARDINAL;
- counter : CARDINAL;
- line : CARDINAL;
- pos : CARDINAL;
-
- BEGIN
- IF Param1[0] = "?"
- THEN
- WriteString("Specify search string (including wildcards)");
- ELSE
- IF Param1[0] = 0C
- THEN
- Param1[0] := "*";
- Param1[1] := 0C;
- END;
-
- counter := 0;
- FindNames("DK", Param1, UpLowEqual);
- WriteLn;
-
- REPEAT
- NextName(foundOne, fileName, fileNo, versionNo);
- IF foundOne
- THEN
- GetPos(line, pos); (* Tab to next position *)
- SetPos(line, (counter MOD 4) * 20);
-
- WriteString(fileName);
- INC(counter);
- END;
- UNTIL NOT foundOne;
-
- WriteLn;
- IF counter = 0
- THEN
- WriteString("No files found");
- ELSE
- WriteC(counter,3);
- WriteString(" file(s) found");
- END;
- WriteLn;
-
- END;
-
- END Dir;
-
- END KermDir.
-